package com.tea.funct.service.impl;

import com.tea.common.utils.DateUtils;
import com.tea.funct.domain.TeaRewardRecord;
import com.tea.funct.mapper.TeaRewardRecordMapper;
import com.tea.funct.service.ITeaRewardRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 奖励记录Service业务层处理
 *
 * @author Sophia
 * @date 2024-05-31
 */
@Service
public class TeaRewardRecordServiceImpl implements ITeaRewardRecordService {
    @Autowired
    private TeaRewardRecordMapper teaRewardRecordMapper;

    /**
     * 查询奖励记录
     *
     * @param id 奖励记录主键
     * @return 奖励记录
     */
    @Override
    public TeaRewardRecord selectTeaRewardRecordById(Long id) {
        return teaRewardRecordMapper.selectTeaRewardRecordById(id);
    }

    /**
     * 查询奖励记录列表
     *
     * @param teaRewardRecord 奖励记录
     * @return 奖励记录
     */
    @Override
    public List<TeaRewardRecord> selectTeaRewardRecordList(TeaRewardRecord teaRewardRecord) {
        return teaRewardRecordMapper.selectTeaRewardRecordList(teaRewardRecord);
    }

    /**
     * 新增奖励记录
     *
     * @param teaRewardRecord 奖励记录
     * @return 结果
     */
    @Override
    public int insertTeaRewardRecord(TeaRewardRecord teaRewardRecord) {
        teaRewardRecord.setCreateTime(DateUtils.getNowDate());
        return teaRewardRecordMapper.insertTeaRewardRecord(teaRewardRecord);
    }

    /**
     * 修改奖励记录
     *
     * @param teaRewardRecord 奖励记录
     * @return 结果
     */
    @Override
    public int updateTeaRewardRecord(TeaRewardRecord teaRewardRecord) {
        return teaRewardRecordMapper.updateTeaRewardRecord(teaRewardRecord);
    }

    /**
     * 批量删除奖励记录
     *
     * @param ids 需要删除的奖励记录主键
     * @return 结果
     */
    @Override
    public int deleteTeaRewardRecordByIds(Long[] ids) {
        return teaRewardRecordMapper.deleteTeaRewardRecordByIds(ids);
    }

    /**
     * 删除奖励记录信息
     *
     * @param id 奖励记录主键
     * @return 结果
     */
    @Override
    public int deleteTeaRewardRecordById(Long id) {
        return teaRewardRecordMapper.deleteTeaRewardRecordById(id);
    }
}
